<template>
  <div class="home">
    <!-- 背景轮播图 -->
    <div class="recommendPage">
      <button @click="login_btn">ddd</button>
      <div class="homepage-hero-module">
        <div class="video-container">
          <div :style="fixStyle" class="filter"></div>
          <video :style="fixStyle" muted='muted' autoplay loop class="fillWidth" v-on:canplay="canplay">
            <source src="../assets/MP4/Tour of a house.mp4" type="video/mp4"/>
          </video>
          <div class="poster hidden" v-if="!vedioCanPlay">
            <img :style="fixStyle" src="../assets/MP4/Kitchen in a house.mp4" alt="">
          </div>
        </div>
      </div>
    </div>


    <!-- 登录区 -->
    <div class="shell" v-show="login">
        <div class="box-left">
            <h2>Login</h2>
            <span>Just log in, you can enjoy more services, interact with me here, and publish your opinions</span>
        </div>
        <div class="box-right">
            <div class="form">
                <label for="email">Email</label>
                <input type="email" id="email">
                <label for="password">Password</label>
                <input type="password" id="password">
                <input type="submit" id="submit" value="Submit">
            </div>
        </div>
    </div>

  
  </div>
</template>

<script>
// 引入插件
// import { swiper, swiperSlide } from "vue-awesome-swiper";
// import "swiper/dist/css/swiper.css";

 export default {
  //  components: {
  //   swiper,
  //   swiperSlide
  // },
    data() {
      return {
        //  swiperOption: {
        //   loop: true,
        //   autoplay: {
        //     delay: 3000,
        //     stopOnLastSlide: false,
        //     disableOnInteraction: false
        //   }
        // },
//背景视频
        vedioCanPlay: false,
        fixStyle: '',
        login:false,
//背景视频
      }
    },
    created() {
  
       

    },
    methods: {
      login_btn(){
      
          this.login = true
      
        
      },
 
//背景视频
       canplay() {
        this.vedioCanPlay = true
      },
//背景视频
      //点击重置按钮
    },
//背景视频
     mounted: function() {
      window.onresize = () => {
        const windowWidth = document.body.clientWidth
        const windowHeight = document.body.clientHeight
        const windowAspectRatio = windowHeight / windowWidth
        let videoWidth
        let videoHeight
        if (windowAspectRatio < 0.5625) {
          videoWidth = windowWidth
          videoHeight = videoWidth * 0.5625
          this.fixStyle = {
            height: windowWidth * 0.5625 + 'px',
            width: windowWidth + 'px',
            'margin-bottom': (windowHeight - videoHeight) / 2 + 'px',
            'margin-left': 'initial'
          }
        } else {
          videoHeight = windowHeight
          videoWidth = videoHeight / 0.5625
          this.fixStyle = {
            height: windowHeight + 'px',
            width: windowHeight / 0.5625 + 'px',
            'margin-left': (windowWidth - videoWidth) / 2 + 'px',
            'margin-bottom': 'initial'
          }
        }
      }
      window.onresize()
    }
  }
//背景视频
</script>
<style lang="less" scoped>


//头像



//背景视频
.recommendPage{
z-index: -0;
}
  .homepage-hero-module,
  .video-container {
    position: relative;
    height: 100vh;
    overflow: hidden;
  }

  .video-container .poster img,
  .video-container video {
    
    position: absolute;
  }

  .video-container .filter {
    
    position: absolute;
    // background: rgba(0, 0, 0, 0.4);
  }

    body {
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            
        }
        .shell{
            width: 640px;
            height: 320px;
            display: flex;
            z-index: 1;
            position: absolute;
            top: 50%;
            right: 0;
            transform: translate(-50%,-50%);
        }
        .box-left{
            background-color: #fff;
            height: 280px;
            top: 20px;
            position: relative;
            width: 50%;
        }
        .box-left h2{
            font: 900 50px '';
            margin: 50px 40px 40px;
        }
        .box-left span{
            display: block;
            color: #999;
            font-style: 14px;
            margin: 40px;
        }
        .box-right{
            background-color: #474a59;
            box-shadow: 0 0 40px 16px rgba(0,0,0,.2);
            color: #f1f1f2;
            width: 50%;
        }
        .form{
            margin: 40px;
            position: absolute;
        }
        label{
            color: #c2c2c5;
            display: block;
            font-size: 14px;
            height: 16px;
            margin-top: 20px;
            margin-bottom: 5px;
            position: relative;
        }
        input{
            background: transparent;
            border: 0;
            color: #f2f2f2;
            font-style: 20px;
            height: 30px;
            line-height: 30px;
            width: 100%;
            outline: none !important;
        }
        label::before{
            content: '';
            display: block;
            position: absolute;
            top: 52px;
            width: 100%;
            height: 3px;
            background-image: linear-gradient(to right,#44ffff,#b888ff);
        }
        #submit{
            color: #fff;
            margin-top: 40px;
            width: 100px;
            height: 35px;
            background-color: rgba(255,255,255,.1);
            border-radius: 20px;
            float: right;
            transition: .3s;
        }
        #submit:hover{
            letter-spacing: 2px;
            color: #000;
            background-color: #fff;
        }
</style>